package com.snailxr.base.task.service;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.snailxr.base.task.dao.impl.APIObjDaoImpl;
import com.snailxr.base.task.domain.APIObj;

@Service("apiService")
public class APIService {

	public final Logger log = Logger.getLogger(this.getClass());
	
	@Resource(name="apiObjDaoImpl")
	private APIObjDaoImpl apiObjDaoImpl;
	/**
	 * 查询全部
	 * @return
	 */
	public List<APIObj> selectAll() {
		return apiObjDaoImpl.selectAll();
	}
	
	/**
	 * 增加一条
	 * @param apiObj
	 */
	public void add(APIObj apiObj){
		apiObjDaoImpl.insert(apiObj);
	}
	
	/**
	 * 删除一条
	 * @param apiObj
	 */
	public void delete(APIObj apiObj){
		int apiId = apiObj.getApiId();
		apiObjDaoImpl.delete(apiId);
	}
	
	/**
	 * 根据apiId查询
	 * @return 
	 */
	public APIObj getByApiId(int apiId){
		return apiObjDaoImpl.selectByPrimaryKey(apiId);
	}
	
}
